package ar.com.poo.vista;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class PopUp extends javax.swing.JFrame {
	private static PopUp app;
	private JLabel mensaje;
	private JButton cerrar;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				PopUp inst = getInstancia();
				inst.setVisible(true);
			}
		});
	}
	
	public static PopUp getInstancia() {
		if (app == null)
			app = new PopUp();
		return app;
	}
	
	private PopUp() {
		super("Mensaje");
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			setLocationRelativeTo(null);
			getContentPane().setLayout(null);
			{
				mensaje = new JLabel();
				getContentPane().add(mensaje);
				mensaje.setBounds(12, 12, 418, 20);
			}
			{
				cerrar = new JButton();
				getContentPane().add(cerrar);
				cerrar.setText("Cerrar");
				cerrar.setBounds(351, 38, 80, 21);
				cerrar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						app.setVisible(false);
						mensaje.setText("");
					}
				});
			}
			pack();
			this.setSize(450, 110);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void agregarMensaje(String msg) {
		mensaje.setText(msg);
	}
	
}
